<template>
	<view>
		<view class="listthr">
			<view class="aui-news-box">
				<view v-for="(list, i) in noticelist" :key="i" class="aui-news-item" @click="click_msgval(list)">
					<view class="aui-news-item-hd">
						<image :src="list.logo"  class="img"/>
						<view class="red" v-if="list.isRead=='未读'"></view>
					</view>
					<view class="aui-news-item-bd">
						<h4>{{list.title}}</h4>
						<p>{{list.summary}}</p>
						<view class="text">{{list.createTime}}</view>
					</view>
				</view>
			</view>
		</view>
		<u-empty :show="noticelist.length==0&&loading?true:false" marginTop="100"></u-empty>
		<u-loadmore :status="loadstatus" line v-if="noticelist.length>0"/>
	</view>
</template>

<script>
	import { notice } from '@/api/index.js';
	export default {
		data() {
			return {
				noticelist:[],
				queryParams:{
					pageNo:1,
					pageSize:10
				},
				loading:false,
				loadstatus:'loading'
			};
		},
		onLoad() {
			this.get_notice()
		},
		methods: {
			get_notice(){
				notice(this.queryParams).then((res) => {
					this.loading = true;
					if(res.data.list.length==0&&this.queryParams.pageNo>1){
						this.loadstatus = 'nomore'
						return
					}
					if(this.queryParams.pageNo==1&&res.data.list.length<10){
						this.loadstatus = 'nomore'
					}
					this.noticelist = this.noticelist.concat(res.data.list)
					this.queryParams.pageNo = res.data.list.length==0?this.queryParams.pageNo:this.queryParams.pageNo+=1
				});
			},
			click_msgval(list){
				uni.navigateTo({
					url:'/pages/index/notice/valcont/valcont?id='+list.id
				})
			}
		},
		onPullDownRefresh() {
			this.queryParams.pageNo = 1
			this.noticelist = []
			this.get_notice()
		},
		onReachBottom() {
			this.get_notice()
			this.loadstatus = 'loading'
		}
	}
</script>

<style lang="scss">
	.listthr{
		margin: 24rpx;
	}
.aui-news-box {
    margin-top: 8rpx;
    background: #fff;
	.aui-news-item {
	    padding: 15rpx;
	    position: relative;
	    display: -webkit-box;
	    display: -webkit-flex;
	    display: flex;
	    -webkit-box-align: center;
	    -webkit-align-items: center;
	    align-items: center;
		.aui-news-item-hd {
		    margin-right: .8em;
		    line-height: 88rpx;
		    text-align: center;
		    background: #fff;
		    border-radius: 15rpx;
			position: relative;
			.img{
				width: 120rpx;
				height: 120rpx;
			}
			.red{
				width: 10rpx;
				height: 10rpx;
				background-color: red;
				border-radius: 50%;
				position: absolute;
				top:35rpx;
				left: -15rpx;
			}
		}
		.aui-news-item-bd {
		    -webkit-box-flex: 1;
		    -webkit-flex: 1;
		    flex: 1;
		    min-width: 0;
			margin-top: -40rpx;
			h4 {
			    font-weight: 400;
			    font-size: 32rpx;
			    width: auto;
			    overflow: hidden;
			    text-overflow: ellipsis;
			    white-space: nowrap;
			    word-wrap: normal;
			    word-wrap: break-word;
			    word-break: break-all;
			    padding-bottom: 10rpx;
			    color: #333;
				margin-top: 4rpx;
			}
			
			p {
			    color: #848689;
			    font-size: 26rpx;
			    line-height: 1.2;
			    overflow: hidden;
			    text-overflow: ellipsis;
			    display: -webkit-box;
			    -webkit-box-orient: vertical;
			    -webkit-line-clamp: 1;
			}
			.text{
				font-size: 24rpx;
				margin: 12rpx 0 0;
				text-align: right;
				color: #d8d8d8;
			}
		}
	}
	.aui-news-item:before {
	    content: '';
	    position: absolute;
	    z-index: 2;
	    bottom: 0;
	    left: 0;
	    width: 100%;
	    height: 2rpx;
	    border-bottom: 2rpx solid #d8d8d8;
	    -webkit-transform: scaleY(0.5);
	    transform: scaleY(0.5);
	    -webkit-transform-origin: 0 100%;
	    transform-origin: 0 100%;
	}
}
</style>
